home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / driver / rxcache.doc < prev    next >
Text File  |  1998-11-03  |  2KB  |  36 lines

  1. RxCache - Regular Expression Cache
  2. ----------------------------------
  3.   Written 1998 by Lars Duening.
  4.   Share and Enjoy!@
  5.  
  6. The rxcache acts as a wrapper around the regcomp() function
  7. in the regexp module. It keeps track of the recently compiled
  8. regular expression and stores both the expression string and
  9. regexp's internal representation. If an expression is found
  10. among the stored ones, the rxcache returns the stored internal
  11. representation compiled earlier.
  12.  
  13. The interface is through the function regcomp_cache() which
  14. takes the same parameters as regcomp(). However, since the
  15. compiled expression is stored and managed by rxcache, the
  16. caller of regcomp_cache() must not deallocate the compiled
  17. expression after use.
  18.  
  19. The expressions are stored in a fixed size table, with entries
  20. indexed by a hash over the pattern string. The table holds
  21. RXCACHE_TABLE entries, and every entry can hold RXCACHE_CHAIN
  22. expressions. Upon a hash collision, one of the stored expressions
  23. is removed (and deallocated) using a round-robin selection.
  24. This behaviour may not be optimal, but on the other hand
  25. eventually deallocates expressions which are no longer used.
  26. The two RXCACHE_ values are defined in config.h.
  27.  
  28. Initial tests showed an acceleration of the regexp _setup_
  29. phase by factor 4. However, since the actual matching is as
  30. fast as before, the net savings will be lower.
  31.  
  32. To install the rxcache, apply the diff file (use parameter
  33. '-p1' with patch) and reconfigure and recompile the driver.
  34.  
  35.  -- Lars Duening; 17. Apr 1998
  36.